package com.example.androidtvdemo.demo05;

import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.androidtvdemo.R;
import com.example.androidtvdemo.net.BlogCategory;

public class CategoryAdapter extends BaseQuickAdapter<BlogCategory.DataCategoryBean, BaseViewHolder> {


    public CategoryAdapter() {
        super(R.layout.item_category_layout);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, BlogCategory.DataCategoryBean item) {
        holder.setText(R.id.btn_type, item.getName());
        holder.itemView.setTag(holder.getAdapterPosition());
        //焦点监听,简单处理
        if (mOnFocusChangeListener != null) {
            holder.itemView.setOnFocusChangeListener(mOnFocusChangeListener);
        }
    }

    public void setOnFocusChangeListener(View.OnFocusChangeListener mOnFocusChangeListener) {
        this.mOnFocusChangeListener = mOnFocusChangeListener;
    }

    private View.OnFocusChangeListener mOnFocusChangeListener;
}
